/*
 * Copyright (C) 2009-2012 Geometer Plus <contact@geometerplus.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA.
 */

package com.example.administrator.fangbook.read.library.db;


import com.example.administrator.fangbook.appliction.HtlApplication;

import org.geometerplus.fbreader.book.FileInfo;
import org.geometerplus.fbreader.book.ReadBook;
import org.geometerplus.zlibrary.core.filesystem.ZLFile;

import java.util.Collection;
import java.util.List;

public abstract class BooksDatabase {
    private static BooksDatabase ourInstance;

    public synchronized static BooksDatabase Instance() {
        if (ourInstance == null) {
            ourInstance = new SQLiteBooksDatabase(HtlApplication.getApplication(), "READER");
        }
        return ourInstance;
    }

    public BooksDatabase() {
        ourInstance = this;
    }


    public abstract Collection<FileInfo> loadFileInfos(ZLFile file);

    public abstract void executeAsATransaction(Runnable actions);

    public abstract void removeFileInfo(long fileId);

    public abstract void saveFileInfo(FileInfo fileInfo);

    public abstract ReadBook loadBookByFile(long fileId, ZLFile file);

//    public abstract List<Author> loadAuthors(long bookId);
//    public abstract List<Tag> loadTags(long bookId);
//    public abstract SeriesInfo loadSeriesInfo(long bookId);
}
